﻿<%@ Page Title="Configure" Language="vb" AutoEventWireup="false" MasterPageFile="~/Site.Master" CodeBehind="Configure.aspx.vb" Inherits="WRDBWeb.Configure" MaintainScrollPositionOnPostback="false" culture="auto" meta:resourcekey="PageResource1" uiculture="auto" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        .auto-style1 {
            width: 363px;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="FeaturedContent" runat="server">
    <section class="featured">
        <div class="content-wrapper">
            <table style="width: 100%">
                <tr>
                    <td>
                        <hgroup class="title">
                            <h1><%: Title %> </h1>
                            <h2><asp:Label ID="lblInfo" runat="server" Text="Choose which predefined WRDB Project you are interested in, then the Master or Working table to access." meta:resourcekey="lblInfoResource1"></asp:Label></h2>
                        </hgroup>
                    </td>
                    <td>
                        <asp:Image ID="Image1" runat="server" ImageAlign="Right" ImageUrl="~/Images/gear_32xLG.png" meta:resourcekey="Image1Resource1" />
                    </td>
                </tr>
            </table>
        </div>
    </section>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="MainContent" runat="server">
    
    <script>
        //capture double-click on tablename
        $(document).ready(function () {
            $("[id$='lstTables']").dblclick(function () {
                $("[id$='btnOK']").click();
            });
            //$("[id$='cboProjects']").click(showProgress());
        });

        //this method requires that the page contain a div called divDialogProgress that looks like this:
        //        <div id="divDialogProgress" title="Please stand by..." style="display:none">
        //          <div id="divProgress"></div>
        //        </div>
        //Will also need the GetResource pagemethod in codebehind
        //It should be called after a button is clicked using OnClientClicked="showProgress(); return true;"

        function showProgress() {
            $("#divProgress").progressbar({
                value: false //indeterminate
            });

            PageMethods.GetResource("ProgressTitle", function (res) {
                $("#divDialogProgress").attr("title", res);
                var dlg = $("#divDialogProgress").dialog({
                    modal: true,
                    width: 300,
                    height: 100,
                    resizable: false,
                    draggable: false,
                    closeOnEscape: false,
                    close: function () { $(this).dialog('destroy').remove() } //the dialogs kept getting added and eventually would not close properly (maybe because placed in panel instead of div); this seems to fix it
                })
            })
        };

        Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest(

            function () {
                if (document.getElementById) {
                    var progress = document.getElementById('progress');
                    var blur = document.getElementById('blur');
                    progress.style.width = '300px';
                    progress.style.height = '30px';
                    blur.style.height = document.documentElement.clientHeight;
                    progress.style.top = document.documentElement.clientHeight / 3 - progress.style.height.replace('px', '') / 2 + 'px';
                    progress.style.left = document.body.offsetWidth / 2 - progress.style.width.replace('px', '') / 2 + 'px';
                }
            }
        )

    </script>

    <br />

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div style="text-align:center">
                <table align="center" style="width: auto">
                    <tr>
                        <td style="width: auto; text-align:right "><asp:label id="lblProject" runat="server" Text="Project:" meta:resourcekey="lblProjectResource1"></asp:label></td>
                        <td class="auto-style1">
                            <asp:DropDownList ID="cboProjects" runat="server" AutoPostBack="True" Width="50em" ToolTip="This is a list of all the WRDB projects that you have access to." meta:resourcekey="cboProjectsResource1">
                            </asp:DropDownList>
                        </td>
                        <td>
                            <asp:Image ID="imgProject" runat="server" Visible="False" ImageUrl="~/Project Images/APOT.jpg" />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: auto;text-align:right; vertical-align:top;"><asp:label id="lblTable" runat="server" Text="Table:" meta:resourcekey="lblTableResource1"></asp:label></td>
                        <td class="auto-style1">
                            <asp:ListBox ID="lstTables" runat="server" Height="104px" Width="50em" ToolTip="This is a list of the Master (at the top) and Working tables available for the Project." meta:resourcekey="lstTablesResource1"></asp:ListBox>
                            <br /><br />
                            <asp:Label ID="lblNote" runat="server" Text="Note: all tables other than the Master contain provisional data which have not been QA/QC checked." Font-Italic="True" Font-Size="Small" meta:resourcekey="lblNoteResource1" Width="50em"></asp:Label>
                            <br /><br />
                        </td>
                    </tr>
                    <tr>
                        <td style="width: auto;text-align:right; vertical-align:top;"></td>
                        <td style="text-align:left; vertical-align:top">
                            <asp:label id="lblTimeout" runat="server" Text="Command Timeout:&nbsp;&nbsp;" meta:resourcekey="lblTimeoutResource1"></asp:label>
                            <asp:TextBox ID="txtTimeout" runat="server" Width="5em" ToolTip="Enter the maximum number of seconds that a query will be allowed to run before generating a timeout error." meta:resourcekey="txtTimeoutResource1"></asp:TextBox>
                            <asp:label id="lblMaxRows" runat="server" Text="&nbsp;&nbsp;&nbsp;&nbsp;Maximum Rows:&nbsp;&nbsp;" meta:resourcekey="lblMaxRowsResource1"></asp:label>
                            <asp:TextBox ID="txtMaxRows" runat="server" Width="5em" ToolTip="Enter the maximum number of records that a query will be allowed to return before generating an error." meta:resourcekey="txtMaxRowsResource1"></asp:TextBox>
                        </td>
                    </tr>
                </table>
            </div>

            <strong><asp:Label ID="lblError" runat="server" Visible="false" Text="Error!" ForeColor="Red" Font-Size="1em" meta:resourcekey="lblErrorResource1"></asp:Label></strong>

            <asp:UpdateProgress ID="UpdateProgress1" runat="server">
                <ProgressTemplate>
                    <div id="blur">&nbsp;</div>
                    <div id="progress" style="text-align: center">
                        <asp:Label ID="lblStandBy" runat="server" Text="Please Stand By..."></asp:Label>
                    </div>
                </ProgressTemplate>
            </asp:UpdateProgress>

            <asp:Panel ID="pnlDialogProjectUsers" runat="server" style="display:none " DefaultButton="btnUsersOK" >
                
                <div id="divDialogProjectUsers" style="width:100%">

                    <h3 style="text-align: center">
                        <asp:Label ID="lblProjectUsers" runat="server" meta:resourcekey="lblProjectUsersResource1" Text="Enter a comma-separated list of users that are to have access to each project; if the list is empty, there are no restrictions."></asp:Label>
                    </h3>

                    <br />

                    <asp:GridView ID="gvProjectUsers" runat="server" CellPadding="4"
                        Height="100%" Width="700px"
                        AllowPaging="False" Font-Size="Small"
                        HorizontalAlign="Center" Font-Names="Verdana" ForeColor="#333333" BorderStyle="Solid" meta:resourcekey="gvProjectUsers1" AutoGenerateEditButton="True">
                        <AlternatingRowStyle BackColor="White" Height="1em" />
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" Wrap="False" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                </div>

                <br />
                <div style="text-align: right">
                    <asp:Button ID="btnUsersOK" runat="server" Text="OK" CommandName="OK" meta:resourcekey="btnOKResource1" />
                    &nbsp;
                    <asp:Button ID="btnUsersCancel" runat="server" Text="Cancel" CommandName="Cancel" meta:resourcekey="btnCancelResource1" />
                </div>

            </asp:Panel>

            <br />

            <table style="width:98%">
                <tr>
                    <td style="width:1px"><asp:Button ID="btnAdvanced" runat="server" Text="Advanced..." CommandName="Advanced" meta:resourcekey="btnAdvancedResource1" /></td>
                    <td style="width:100%"></td>
                    <td style="width:1px"><asp:Button ID="btnOK" runat="server" Text="OK" CommandName="OK" meta:resourcekey="btnOKResource1" /></td>
                    <td style="width:1px"><asp:Button ID="btnCancel" runat="server" Text="Cancel" CommandName="Cancel" meta:resourcekey="btnCancelResource1" /></td>
                </tr>
            </table>

            <div id="divDialogProgress" title="Please stand by..." style="display: none">
                <div id="divProgress"></div>
            </div>

            <asp:Panel ID="pnlDialogPassword" runat="server"  style="display:none" DefaultButton="btnPasswordOK" >
                <asp:TextBox ID="txtPassword" runat="server" TextMode="Password" Width="98%"></asp:TextBox>
                <br />
                <br />
                <div style="text-align: right">
                    <asp:Button ID="btnPasswordOK" runat="server" Text="OK" CommandName="OK" meta:resourcekey="btnOKResource1" />
                    &nbsp;
                    <asp:Button ID="btnPasswordCancel" runat="server" Text="Cancel" CommandName="Cancel" meta:resourcekey="btnCancelResource1" />
                </div>
            </asp:Panel>

        </ContentTemplate>

        <Triggers>
            <asp:AsyncPostBackTrigger ControlID="btnAdvanced" />
            <asp:PostBackTrigger ControlID="btnOK" />
            <asp:PostBackTrigger ControlID="btnCancel" />
        </Triggers>
         
    </asp:UpdatePanel>

</asp:Content>
